package com.example.mapp;

import com.example.entity.ElevatorType;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by youkun on 2017/9/22.
 */
@Mapper
public interface ElevatorTypeMapp {

    @Select(" select * from elevator_type  where id=#{id}")
    ElevatorType queryById(String id) throws Exception;

    @Delete("delete from elevator_type where id=#{id}")
    int deleteById(String id)throws Exception;

    @Insert(" insert into elevator_type (type_name,type_description) value (#{typeName},#{typeDescription})")
    @SelectKey(statement="select last_insert_id()",keyProperty = "id",keyColumn = "id",before = false,resultType = Long.class)
    int add(ElevatorType elevatorType) throws Exception;

    @Update(" update elevator_type set type_name=#{typeName},type_description=#{typeDescription} where id=#{id}")
    int update(ElevatorType elevatorType)throws Exception;

    @Select(" select * from elevator_type ")
    List<ElevatorType> queryList() throws Exception;

    @Select("select * from elevator_type where type_name=#{typeName}")
    ElevatorType queryByTypeName(String typeName) throws Exception;

}
